﻿#ifndef LIGHTPOINT_H
#define LIGHTPOINT_H

#include <QWidget>
#include <QLabel>
#include <qtimer.h>

class LightPoint : public QLabel
{
    Q_OBJECT
public:
    explicit LightPoint(QWidget *parent = nullptr);
    ~LightPoint();

protected:
    void paintEvent(QPaintEvent *) override;
    void drawBg(QPainter *painter);

private:
    int step;   //颜色透明渐变步长
    int interval;   //定时器间隔
    QColor bgColor;   //背景颜色

    QTimer *timer;  //定时器
    int offset;  //偏移
    bool add;    //是否增加

public:
    int getStep()           const;
    int getInterval()       const;
    QColor getBgColor()     const;

    QSize sizeHint()        const override;
    QSize minimumSizeHint() const override;

public slots:
    void setStep(int step);
    void setInterval(int interval);
    void setBgColor(const QColor &bgColor);
};

#endif // LIGHTPOINT_H
